import request from '@/config/axios'

// 职工信息 VO
export interface EmployeeInfoVO {
  id: number // 主键ID
  depId: number // 所属部门
  seqId: number // 职位序列
  posId: number // 职位
  empType: string // 类型
  empName: string // 姓名
  empNo: string // 工号
  mobile: string // 手机
  gender: string // 性别
  birthDate: Date // 生日
  idNo: string // 身份证号
  politicalStatus: string // 政治面貌
  ethnicity: string // 民族
  maritalStatus: string // 婚姻状况
  hometown: string // 籍贯
  englishLevel: string // 英语等级
  externalDate: Date // 校外工作起始日期
  collegeEntryDate: Date // 学院入职时间
  idAddress: string // 身份证地址
  homeAddress: string // 现家庭地址
  teacherCert: string // 教师资格证
  teacherCertNo: string // 资格证编号
  bankCardNumber: string // 银行卡号
  emergencyContact: string // 紧急联系人
  contactRelationship: string // 与紧急联系人关系
  emergencyPhone: string // 紧急联系人电话
  typeFlag: string // 身份标记
  statusFlag: string // 状态标记
  remarks: string // 备注信息
}

// 职工信息 API
export const EmployeeInfoApi = {
  // 查询职工信息分页
  getEmployeeInfoPage: async (params: any) => {
    return await request.get({ url: `/pm/employee-info/page`, params })
  },

  // 查询职工信息详情
  getEmployeeInfo: async (id: number) => {
    return await request.get({ url: `/pm/employee-info/get?id=` + id })
  },

  // 新增职工信息
  createEmployeeInfo: async (data: EmployeeInfoVO) => {
    return await request.post({ url: `/pm/employee-info/create`, data })
  },

  // 修改职工信息
  updateEmployeeInfo: async (data: EmployeeInfoVO) => {
    return await request.put({ url: `/pm/employee-info/update`, data })
  },

  // 删除职工信息
  deleteEmployeeInfo: async (id: number) => {
    return await request.delete({ url: `/pm/employee-info/delete?id=` + id })
  },

  // 导出职工信息 Excel
  exportEmployeeInfo: async (params) => {
    return await request.download({ url: `/pm/employee-info/export-excel`, params })
  },

// ==================== 子表（职工学历） ====================

  // 获得职工学历分页
  getEmployeeEducationsPage: async (params) => {
    return await request.get({ url: `/pm/employee-info/employee-educations/page`, params })
  },
  // 新增职工学历
  createEmployeeEducations: async (data) => {
    return await request.post({ url: `/pm/employee-info/employee-educations/create`, data })
  },

  // 修改职工学历
  updateEmployeeEducations: async (data) => {
    return await request.put({ url: `/pm/employee-info/employee-educations/update`, data })
  },

  // 删除职工学历
  deleteEmployeeEducations: async (id: number) => {
    return await request.delete({ url: `/pm/employee-info/employee-educations/delete?id=` + id })
  },

  // 获得职工学历
  getEmployeeEducations: async (id: number) => {
    return await request.get({ url: `/pm/employee-info/employee-educations/get?id=` + id })
  },

// ==================== 子表（职工职称） ====================

  // 获得职工职称分页
  getEmployeeTitlesPage: async (params) => {
    return await request.get({ url: `/pm/employee-info/employee-titles/page`, params })
  },
  // 新增职工职称
  createEmployeeTitles: async (data) => {
    return await request.post({ url: `/pm/employee-info/employee-titles/create`, data })
  },

  // 修改职工职称
  updateEmployeeTitles: async (data) => {
    return await request.put({ url: `/pm/employee-info/employee-titles/update`, data })
  },

  // 删除职工职称
  deleteEmployeeTitles: async (id: number) => {
    return await request.delete({ url: `/pm/employee-info/employee-titles/delete?id=` + id })
  },

  // 获得职工职称
  getEmployeeTitles: async (id: number) => {
    return await request.get({ url: `/pm/employee-info/employee-titles/get?id=` + id })
  },
}